/*
Copyright Brian Dawn 2008.
Notes
 -Uses singleton design.
*/
#ifndef TEXTUREMANAGER_H
#define TEXTUREMANAGER_H

#include <IL/il.h> //devIL library for image loading.
#include <GL/glut.h>
#include <vector>
#include <iostream>
#include <string>
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/filesystem/path.hpp>
struct tex{
	GLuint texture;
	std::string id;
	int width, height;
};

struct texAnimStrip{
	std::vector<GLuint> texture;
	std::string id;

	int width, height;
	int cells;
};

class textureManager{
protected:
	std::vector<tex*> texture;
	std::vector<texAnimStrip*> textureAnimStrip;
	textureManager();
	textureManager(const textureManager&);
	textureManager& operator =(const textureManager&);
private:
	static textureManager* pinstance;
public:
	bool setTexture(std::string id);
	void clearTextures();
	void freeTexture(std::string id);
	bool loadTexture(std::string path);
	bool loadAnimationStrip(std::string path, int rows, int columns);
	int getTextureWidth(std::string id);
	int getTextureHeight(std::string id);
	GLuint getTexture(std::string id);
	static textureManager* instance();
	~textureManager();
};

textureManager* TM();

void loadImageDirectory(const boost::filesystem::path & directory, bool recurse_into_subdirs);


#endif